
module Main where
import System
import Data.List
import LanguageCompilerCommon

 

main = do
    files <- getArgs
    program <- getProgName
    if length files /= 2
        then putStr $ "Usage: " ++ program ++ " sourceFile targetFile"
        else do
        let fileName = head files
        source <- readFile fileName
        case compileString source of
            Left msg -> putStrLn msg
            Right code -> writeFile (files !! 1) (code "")
--    where
--        first fileName = 
--            case (findIndex (=='.') fileName) of
--                    Just i -> take i fileName
--                    Nothing -> fileName 
                    

